//贪心算法
//1.顾客拿5块钱直接手下
//2.顾客拿10  找5
//3.顾客拿20  可以选择找10+5 或者3张5
function packs(bills){
    let fiveNum = 0
    let tenNum = 0
    for(i=0;i<bills.length;i++){
        let bill = bills[i]
        if(bill == 5){
            fiveNum += 1
        }else if(bill == 10){
            if(fiveNum>0){
                fiveNum -= 1
                tenNum +=1
            }else{
                return false
            }
        }else{  
            if(tenNum>0 && fiveNum>0){
                fiveNum -= 1
                tenNum -=1
            }else if(fiveNum>2){
                fiveNum -= 3
            }else{
                return false
            }
            
        }
    }
    return true
}